


import 'package:bike_ride/api/common_repository.dart';
import 'package:bike_ride/common/mvvm/base_view_model.dart';
import 'package:bike_ride/common/widget/notifier_widget.dart';
import 'package:bike_ride/model/cycle_record/view/cycle_record_v.dart';
import 'package:bike_ride/model/cyling/model/unpay_info_m.dart';
import 'package:dio/dio.dart';

class CyclingRecordViewModel extends PageViewModel<CyclingRecordViewState> {
  CancelToken? cancelToken;


  @override
  onCreate() {
    cancelToken = CancelToken();
    pageDataModel = PageDataModel();
    requestData();
  }

  @override
  onDispose() {
    if (!(cancelToken?.isCancelled ?? true)) {
      cancelToken?.cancel();
    }
    super.onDispose();
  }


  Future<List<UnPayInfoM>> getUnPayOrder(int page) async {
    return await CommonRepository.getUnPayOrderIdl(
      cancelToken: cancelToken,
      page: page,
    );
  }

  Future<List<UnPayInfoM>> getFinishOrderDetail(int page,{int? status}) async {
    return await CommonRepository.getFinishOrderListIdl(
      cancelToken: cancelToken,
      page: page,
      status: status,
    );
  }

  /// 请求数据
  @override
  Future<PageViewModel?> requestData({Map<String, dynamic>? params}) async {
    return null;

  }
}